package study.三种方式实现生产者消费者模式.blockingQueue;

public class TestBlockingQueue {

	public static void main(String[] args) {
		Storer storer=new Storer();
		
		Producer producer1=new Producer(storer,"producer1");
		Producer producer2=new Producer(storer,"producer2");
		Producer producer3=new Producer(storer,"producer3");
		Producer producer4=new Producer(storer,"producer4");
		
		Consumer consumer1=new Consumer(storer,"consumer1");
		Consumer consumer2=new Consumer(storer,"consumer2");
		Consumer consumer3=new Consumer(storer,"consumer3");
		Consumer consumer4=new Consumer(storer,"consumer4");
		
		producer1.setNumber(2);
		producer2.setNumber(2);
		producer3.setNumber(2);
		producer4.setNumber(9);
		
		consumer1.setNumber(2);
		consumer2.setNumber(2);
		consumer3.setNumber(2);
		consumer4.setNumber(8);
		
		producer1.start();
		producer2.start();
		producer3.start();
		producer4.start();
		
		consumer1.start();
		consumer2.start();
		consumer3.start();
		consumer4.start();
	}

}
